# 给定一个整数数组 nums，返回所有可能的子集（幂集）。
def solve(nums: list[int]):
    length = len(nums)
    result = []
    for status in range(2**length):
        path = []
        c = status
        index = 0
        while c:
            if c%2:
                path.append(nums[index])
            index += 1
            c //= 2
        result.append(path)
    return result

if __name__ == "__main__":
    print(solve([1, 2, 3]))
